<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="box">
      <kfm-table :data="tableData" border="1" width="800px"></kfm-table>
    </div>
    <script src="../vue3.2.45.js"></script>
    <script>
      let data = [
        {
          id: 1,
          name: "张三",
          age: 20,
        },
        {
          id: 2,
          name: "李四",
          age: 18,
        },
      ];
      const app = Vue.createApp({
        data() {
          return {
            tableData: data,
          };
        },
      });

      app.component("kfm-table", {
        props: ["data", "border", "width"],
        template: `
                <table :border="border" :width="width">
                    <tr v-for="d in data">
                        <td>{{ d.id }}</td>
                        <td>{{ d.name }}</td>
                        <td>{{ d.age }}</td>
                    </tr>
                </table>
            `,
      });

      app.mount("#box");
    </script>
  </body>
</html>
